#include "townhall.h"
#include "townhallstates.h"
#include <cassert>

TownHall::TownHall(int iID):BaseGameEntity(iID)
{
	EntityManager::Instance()->RegisterEntity(this);
	m_pStateMachine = new StateMachine<TownHall>(this);

	m_pStateMachine->SetGlobalState(TownHallGlobalState::Instance());
}

/*-------------------------------------------------------------------------------------------------------------*/
bool TownHall::Initialize()
{
	if (!this->LoadIni("data/graphics/buildings/buildings.spr"))
	{
		return false;
	}

	SetFrame(0);

	return true;
}

/*-------------------------------------------------------------------------------------------------------------*/
TownHall::~TownHall()
{
	EntityManager::Instance()->RemoveEntity(this);
	delete m_pStateMachine;
}

/*-------------------------------------------------------------------------------------------------------------*/
void TownHall::Update(float fDt)
{
	Sprite::Update(fDt);
	m_pStateMachine->Update();
}

/*-------------------------------------------------------------------------------------------------------------*/
void TownHall::Draw()
{
	Sprite::Draw();
}